{include_core file="lib/header.html" center="center" title="个人中心"}
{include_core file="lib/top_nav.html" }
<div class="container">
    <div class="inner">
      <div class="con-top clearfix">
        {include_core file="lib/sidebar.html" crumbs_1="center" crumbs_2="user"}
        <div class="content">
          <div class="account clearfix">
            <div class="edit-up"><em></em><a href="{AnUrl('user/setting/user_info')}">修改</a></div>
            <div class="acc clearfix">
              <h3><a href="{AnUrl('user/setting/user_info')}"><img src="{user_helper::avatar($user_info['id'])}" alt="头像"/></a></h3>
              <dl>
                <dt>{user_helper::get_nick_name($user_info['id'])}</dt>
                <dd>ID : {$user_info['id']}</dd>
              </dl>
            </div>
            <div class="out">
              {if $user_info['mobile'] && $user_info['email']}
                <a class="circle" href="{AnUrl('user/setting/account_safety')}" ><em>较高</em>账户安全</a>
              {elseif $user_info['mobile'] || $user_info['email']}
                <a class="circle-curr2" href="{AnUrl('user/setting/account_safety')}" ><em>一般</em>账户安全</a>
              {else}
                <a class="circle-curr" href="{AnUrl('user/setting/account_safety')}" ><em>较低</em>账户安全</a>
              {/if}
              
              {if $user_info['mobile']} 
                <a class="circle2-curr" href="{AnUrl('user/setting/account_safety')}"><em class="ico"></em>已绑定</a>
              {else}
                <a class="circle2" href="{AnUrl('user/setting/account_safety')}"><em class="ico"></em>立即绑定</a>
              {/if}
              {if $user_info['email']}
                {if $user_info['is_check_email']}
                    <a class="circle3" href="{AnUrl('user/setting/account_safety')}"><em class="ico"></em>已绑定</a>
                {else}
                    <a class="circle3-curr" href="{AnUrl('user/setting/send_check_email')}"><em class="ico"></em>立即验证</a>
                {/if}
              {else}
                <a class="circle3-curr" href="{AnUrl('user/setting/account_safety')}"><em class="ico"></em>立即绑定</a>
              {/if}
            </div>
          </div>
          
          <!--account  end-->
          {*
          <div class="order clearfix">
            <div class="deta">
              <div class="order-up">
                <h3>订单详情</h3>
                <div class="my-order">
                  <div class="order-banner">
                    <a href="javascript:void(0);" class="curr">未支付订单<span>{order_helper::get_order_total(1)}</span></a>
                    <a href="javascript:void(0);"><em>　|　</em>未收货订单<span>{order_helper::get_order_total(15)}</span></a>
                  </div>
                  <ul class="order-cou js_centerOrderList">
                    <li class="curr">
                      {if $order_has_list}
                      <div class="order-deta clearfix">
                        <div class="mr_frbox">
                          {if count($order_has_list)>1}
                          <a href="javascript:void(0);" class="mr_frBtnL prev"></a>
                          {/if}
                          <div class="mr_frUl">
                            <dl id="scrollImg">
                              {foreach $order_has_list as $k=>$v}
                              <dd class="clearfix">
                                <p class="deta-txt js_openLink" data-href="{AnUrl("order/{$v.id}")}">
                                  <span>订单号：{$v.order_code}</span>
                                  <span>　/　</span>
                                  <span>{substr($v.add_time, 0, 10)} </span>
                                  <span>>></span>
                                </p>
                                <div class="deta-shopp {if count($v.detail) == 1}one{/if}">
                                  {foreach $v.detail as $key=>$value}
                                  {if $key < 4}
                                  <div class="deta-sroll">
                                    <h6 class="js_openLink" data-target="_blank" data-href="{AnUrl("goods/{$value.goods_id}")}"><img src="{_image($value.goods_cover, 'middle')}" /></h6>
                                    <p class="deta-txt2 js_openLink not-line" data-target="_blank" data-href="{AnUrl("goods/{$value.goods_id}")}">{$value.goods_title}</p>
                                    <p class="deta-txt3">{number_format($value.goods_price, 2)}元<span style="color:#888"> x {$value.goods_num}</span></p>
                                  </div>
                                  {/if}
                                  {/foreach}
                                  <div class="shopp-footer">
                                    <div class="deta-wary"><span class="deta-txt6">共计：</span><span class="deta-txt4">{number_format($v.price, 2)}</span><span class="deta-txt5">元</span></div>
                                    <div class="deta-pay"><span class="deta-back js_cancelOrder" data-order_id="{$v.id}">取消订货</span><a href="javascript:void(0);" class="js_openLink" data-login="1" data-target="_blank" data-href="{order_helper::get_order_pay_url($v.id)}">付款</a></div>
                                  </div>
                                </div>
                              </dd>
                              {/foreach}
                            </dl>
                          </div>
                          {if count($order_has_list)>1}
                          <a href="javascript:void(0);" class="mr_frBtnR next"></a>
                          {/if}
                        </div>
                      </div>
                      {else}
                      <div class="shopp">
                        <a href="javascript:void(0);">好久没在NBD商城买东西了，快去逛逛吧~</a>
                      </div>
                      {/if}
                      <!--order-deta  end-->
                    </li>
                    <li>
                      {if $order_express_list}
                      <div class="order-deta clearfix">
                        <div class="mr_frbox">
                          {if count($order_express_list) > 1}
                          <a href="javascript:void(0);" class="mr_frBtnL prev"></a>
                          {/if}
                          <div class="mr_frUl">
                            <dl id="scrollImg">
                              {foreach $order_express_list as $k=>$v}
                              <dd class="clearfix">
                                <p class="deta-txt js_openLink" data-href="{AnUrl("order/{$v.id}")}">
                                  <span>订单号：{$v.order_code}</span>
                                  <span>　/　</span>
                                  <span>{substr($v.add_time, 0, 10)} </span>
                                  <span>>></span>
                                </p>
                                <div class="deta-shopp {if count($v.detail) == 1}one{/if}">
                                  {foreach $v.detail as $key=>$value}
                                  {if $key < 4}
                                  <div class="deta-sroll">
                                    <h6 class="js_openLink" data-target="_blank" data-href="{AnUrl("goods/{$value.goods_id}")}"><img src="{_image($value.goods_cover, 'middle')}" /></h6>
                                    <p class="deta-txt2 js_openLink not-line" data-target="_blank" data-href="{AnUrl("goods/{$value.goods_id}")}">{$value.goods_title}</p>
                                    <p class="deta-txt3">{number_format($value.goods_price, 2)}元<span style="color:#888"> x {$value.goods_num}</span></p>
                                  </div>
                                  {/if}
                                  {/foreach}
                                  <div class="shopp-footer">
                                    <div class="deta-wary"><span class="deta-txt6">共计：</span><span class="deta-txt4">{number_format($v.price, 2)}</span><span class="deta-txt5">元</span></div>
                                    <div class="deta-pay"><a href="javascript:void(0);" class="js_receiverOrder" data-id="{$v.id}">确认收货</a></div>
                                  </div>
                                </div>
                              </dd>
                              {/foreach}
                            </dl>
                          </div>
                          {if count($order_express_list) > 1}
                          <a href="javascript:void(0);" class="mr_frBtnR next"></a>
                          {/if}
                        </div>
                      </div>
                      {else}
                      <div class="shopp">
                        <a href="javascript:void(0);">好久没在NBD商城买东西了，快去逛逛吧~</a>
                      </div>
                      {/if}
                      <!--order-deta  end-->
                    </li>
                  </ul>
                </div>
              </div>
            </div>

            <div class="total">
              <div class="cenvert">
                <span class="num">同步中...</span>
                <span class="num2">积分</span>
                <div><a href="{$smarty.const.BBS_URL}" target="_blank">签到送积分</a></div>
              </div>
              <div class="loan">
                <span>兑换券</span>
                <span class="num3">8</span>
                <span>张</span>
                <div class="loan-btn"><a href="{AnUrl('integral')}">去兑换</a></div>
              </div>
            </div>
          </div>
          <!--order  end-->
          *}
          <!-- order start -->
          <div class="order clearfix">
            <div class="deta">
              <div class="order-up">
                <h3>订单详情</h3>
                <div class="my-order">
                  <div class="order-banner">
                    <a href="javascript:void(0);" class="curr">未支付订单<span>{order_helper::get_order_total(1)}</span></a>
                    <a href="javascript:void(0);"><em>　|　</em>未收货订单<span>{order_helper::get_order_total(15)}</span></a>
                  </div>
                  {$service_type = service_helper::get_view_type()}
                  {if $service_type > 0}
                  <div class="look-link">
                    {if $service_type == 1}
                    您的退货单状态有更新，去<a href="{AnUrl('refund')}">查看退货单></a>
                    {elseif $service_type == 2}
                    您的换货单状态有更新，去<a href="{AnUrl('barter')}">查看换货单></a>
                    {else}
                    您的维修单状态有更新，去<a href="{AnUrl('repair')}">查看维修单></a>
                    {/if}
                  </div>
                  {/if}
                  <ul class="order-cou">
                    {if $order_has_list}
                    <li class="curr" style="height:272px">
                      <div class="order-deta clearfix">
                        <table>
                          {foreach $order_has_list as $k=>$v}
                          <tr>
                            <td><img src="{_image($v.detail[0].goods_cover)}" width="60"></td>
                            <td>订单号：{order_helper::order_id_encode($v.id, 1)} </td>
                            <td class="font-red">  {$v.price}元</td>
                            <td><a href="{AnUrl("order/{$v.id}")}" class="detail-btn">订单详情</a></td>
                            <td><a {if $v.pay_type != 2}href="{AnUrl("{openapi_config::$pay_type[$v.pay_type]['module']}?order_id={$v.id}")}"{else}href="{AnUrl("order/{$v.id}.html?showwxpaytitle=1&direct_pay=1")}" {/if} class="pay-btn">付款</a></td>
                          </tr>
                          {/foreach}
                        </table>
                      </div>
                      <!--order-deta  end-->
                    </li>
                    {else}
                    <li class="curr" style="height:272px; margin-top: 10px;">
                      <div class="shopp">
                        <a href="javascript:void(0);">好久没在NBD商城买东西了，快去逛逛吧~</a>
                      </div>
                    </li>
                    {/if}
                    {if $order_express_list}
                    <li style="height:272px">
                      <div class="order-deta clearfix">
                        <table>
                          {foreach $order_express_list as $k=>$v}
                          <tr>
                            <td><img src="{_image($v.detail[0].goods_cover)}" width="60"></td>
                            <td>订单号：{order_helper::order_id_encode($v.id, 1)} </td>
                            <td class="font-red">  {$v.price}元</td>
                            <td><a href="{AnUrl("order/{$v.id}")}" class="detail-btn">订单详情</a></td>
                            <td><a href="javascript:;" class="pay-btn js_receiverOrder" data-id="{$v.id}">确认收货</a></td>
                          </tr>
                          {/foreach}
                        </table>
                      </div>
                      <!--order-deta  end-->
                    </li>
                    {else}
                    <li style="height:272px; margin-top: 10px;">
                      <div class="shopp">
                        <a href="javascript:void(0);">暂时没有未收货订单哦~</a>
                      </div>
                    </li>
                    {/if}
                  </ul>
                </div>
              </div>
            </div>
          </div>
          <!-- order End -->

        

          <div class="shopping clearfix">
            <div class="cart">
              <h3>购物车</h3>
              {if $cart_list}
              <div class="device clearfix">
                {if count($cart_list) > 1}
                <a class="arrow-left" href="javascript:void(0);"></a> 
                <a class="arrow-right" href="javascript:void(0);"></a>
                {/if}
                <div class="swiper-container">
                  <div class="swiper-wrapper">
                    {foreach $cart_list as $k=>$v}
                    <div class="swiper-slide">
                      <div class="comm clearfix">
                        <h1><img src="{_image($v.goods_cover)}" width="230" height="230"/></h1>
                        <dl>
                          <dt class="not-line">{$v.goods_title}</dt>
                          <dd><span>{number_format($v.goods_price, 2)}</span>元</dd>
                          <dd><a href="{AnUrl('cart')}">去结算</a></dd>
                        </dl>
                      </div>
                    </div>
                    {/foreach}
                  </div>
                </div>
                <div class="pagination"></div>
              </div>
              {else}
              <div class="shoppcat">
                <a href="javascript:void(0);">购物车中还没有商品，赶紧选购吧！</a>
              </div>
              {/if}
            </div>
            
            <div class="total">
              <div class="cenvert">
                <span class="num js_bbsCredit"><img src="{$smarty.const.SITE_URL}/images/loading-red.gif" width="20" alt=""></span>
                <span class="num2">积分</span>
                <div><a href="{$smarty.const.BBS_URL}" target="_blank">签到送积分</a></div>
              </div>
              <div class="loan">
                <span>兑换券</span>
                <span class="num3">0</span>
                <span>张</span>
                <div class="loan-btn loan-btn2"><a href="javascript:;" data-href="{AnUrl('integral')}">敬请期待</a></div>
              </div>
            </div>

            {*
            <div class="collect">
              <h3>收藏夹</h3>
              {if $fav_list}
                <div class="collect-list">
                  <div class="mr_frbox2">
                    {if count($fav_list) > 2}
                      <a href="javascript:void(0);" class="mr_frBtnR prev"></a>
                      <a href="javascript:void(0);" class="mr_frBtnL next"></a>
                    {/if}
                    <div class="mr_frUl2">
                      <ul id="mr_fu" class="clearfix">
                      {foreach $fav_list as $k=>$v}
                      {$goods_info = _uri('goods', $v.res_id)}
                      {$goods_cover = _uri('attachment', $goods_info.cover, 'path')}
                        <li>
                          <div class="collect-hover">{$goods_info.title}</div>
                          <h6><a href="{AnUrl("goods/{$goods_info.id}")}"><img src="{_image($goods_cover)}" width="155"/></a></h6>
                          <p class="collect-txt">
                            <span class="collect-pirce">{$goods_info.price}</span>
                            <span class="collect-pirce2">元</span>
                          </p>
                        </li>
                      {/foreach}
                      </ul>
                    </div>
                  </div>
                </div>
              {else}
                <div class="collect-box"><a href="javascript:void(0);">您还没有收藏商品~</a></div>
              {/if}
            </div>
            *}

          </div>
          <!--shopping  end-->

        </div>
        <!--content  end-->
      </div>
      <!--con-top  end-->
      {widget model="goods" func="get_star_list" file="star_list.html" per_page=4}
      <!--con-botm end-->
    </div>
    <!--inner  end-->
  </div>
  <!--container  end-->
  {load_js file="jquery.SuperSlide2.js"}
  <script>
  $(function(){
    //同步积分
    getCredit();

    /* 图片滚动效果 */
    $(".mr_frbox").slide({
      titCell: "",
      mainCell: ".mr_frUl dl",
      autoPage: true,
      effect: "leftLoop",
      //autoPlay: true,
      vis: 1
    });
    
    $(".mr_frbox2").slide({
      titCell: "",
      mainCell: ".mr_frUl2 ul",
      autoPage: true,
      effect: "leftLoop",
      //autoPlay: true,
      vis: 2
    });

    //对齐侧边栏和主体部分
    var cHeight = $('.inner .content').height();
    $('.inner .sidebar').css('height', cHeight + 'px');
     
    var mySwiper = new Swiper('.swiper-container',{
      pagination: '.pagination',
      loop:true,
      grabCursor: true,
      paginationClickable: true
    })
    $('.arrow-left').on('click', function(e){
      e.preventDefault()
      mySwiper.swipePrev()
    })
    $('.arrow-right').on('click', function(e){
      e.preventDefault()
      mySwiper.swipeNext()
    })
    $('.con-botm .shift').mouseenter(function(){
        $(this).children('.add').css('display','block');
    }).mouseleave(function(){
        $(this).children('.add').css('display','none');
    });

    // 切换订单
    $('.js_sltOrderStatus').on('click', function(){
      $(this).siblings('.js_sltOrderStatus').removeClass('curr').next().removeClass('curr');
      $(this).addClass('curr').next().addClass('curr');
      var status = $(this).data('status');
      var currStatus = $('.js_orderDiv').attr('data-curr_status');
      if (status != currStatus) {
        getOrderList(status);
      }
      return false;
    });

    $('body').on('click', '.js_cancelOrder',function(){
      var that = $(this);
      var orderId = $(this).attr('data-order_id');
      var url = siteUrl+'/order/cancel_order';
      showConfirm('您确定要取消当前订单吗？', function(){
        $.post(url, { order_id:orderId }, function(json){
          if (json.info == 'ok') {
            window.location.href = window.location.href;
          } else {
            showMsg(json.info);
          }
        }, 'json');
      });
    });

    $('.js_receiverOrder').on('click', function(){
      var url = siteUrl+'/order/sure_receive';
      var id = $(this).data('id');
      showConfirm('您确定已经收到商品了吗？', function(){
        $.post(url, { id:id }, function(json){
          if (json.info == 'ok') {
            window.location.href = window.location.href;
          } else {
            showMsg(json.info);
          }
        }, 'json');
      })
    });
  });

  var getCredit = function(){
    var url = siteUrl+'/user/setting/get_credit';
    $.get(url, {  }, function(json){
      if (json.info == 'ok') {
        $('.js_bbsCredit').html(json.credit);
      } else {
        $('.js_bbsCredit').html('0');
      }
    }, 'json');
  }
  </script>

{include_core file="lib/footer.html"}